<?php
/**
 * Created by PhpStorm.
 * User: MACHENIKE
 * Date: 2017/7/12
 * Time: 14:04
 */

namespace Home\Controller;

use Server\PayService;
use Think\Controller;

class RsaCheckController extends Controller {

    public function verify() {
//        $data = file_get_contents("php://input");
        $data = I('post.');
//        dump($data);die();
        $sign = I('post.sign.class');
        unset($data['sign.class']);
        $result = PayService::check_data($data,$sign);
        if($result) {
            $data_result['code'] = '10000';
            $data_result['message'] = '成功';
            $data_result['data'] = $data['data'];
            $data_result['sign.class'] = $sign;
            $this->ajaxReturn($data_result);
            die();
        }
        $this->ajaxReturn($result);
    }

    public function xlyVerify() {
        $data = I('post.');
//        dump($data);die();
        $sign = I('post.sign.class');
        unset($data['sign.class']);
        $result = PayService::xly_check_data($data,$sign);
        if($result) {
            $data_result['code'] = '10000';
            $data_result['message'] = '成功';
            $data_result['data'] = $data['data'];
            $data_result['sign.class'] = $sign;
            $this->ajaxReturn($data_result);
            die();
        }
        $this->ajaxReturn($result);
    }
}